package com.hua.api.core.constants;

import com.hua.api.core.util.StringUtil;

import java.util.Arrays;
import java.util.Optional;


public class Status {

    public final static String LOGIC_TRUE="1";//逻辑删除
    public final static String LOGIC_FALSE="0";

    public static final Integer LOGIC_Y=1;
    public static final Integer LOGIC_N=0;

    public static final String GEO_AMAP="amap";
    public static final String GEO_TENCENT="tencent";

    public static final String CHANNEL_HUAWA="huawa";
    public static final String CHANNEL_HUA1000="hua1000";
    public static final String SOURCE_WECHAT="wechat";

    public static final String store = "store";
    public static final String admin = "admin";

    public static final String income = "income";
    public static final String outcome = "topay";

    public static final Integer CHARGE_HUAYT = 0;
    public static final String userMessage = "userMesssage:";

    public static final String mp3_order_bid = "https://img.hua1000.com.cn/official/mp3/orderBid.mp3";
    public static final String mp3_order_info = "https://img.hua1000.com.cn/official/mp3/orderInfo.mp3";



    public  enum BillMode {
        bill_no(0,"待结算"),
        bill_yes(1,"已结算"),
        bill_none(2,"无需结算");

        private String name;
        private Integer value;
        BillMode(Integer value,String name){
            this.value=value;
            this.name=name;
        }

        public static BillMode fromValue(String val){
            Optional<BillMode> first = Arrays.stream(BillMode.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return null;
        }

        public Integer getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public  enum PayRefund {
        success("SUCCESS","退款成功"),
        processing("PROCESSING","退款处理中"),
        closed("CLOSED"," 退款关闭"),
        abnormal("ABNORMAL","退款异常"),
        none("NONE","NONE");

        private String name;
        private String value;
        PayRefund(String value,String name){
            this.value=value;
            this.name=name;
        }
        public static PayRefund fromValue(String val){
            Optional<PayRefund> first = Arrays.stream(PayRefund.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return PayRefund.none;
        }
        public String getValue() {
            return value;
        }
        public String getName() {
            return name;
        }
    }

    // 微信支付状态
    public  enum PayTrade {
        success("SUCCESS","支付成功"),
        refund("REFUND","转入退款"),
        nopay("NOPAY","未支付"),
        closed("CLOSED","已关闭"),
        revoked("REVOKED","已撤销"),
        userpaying("USERPAYING","用户支付中"),
        payerror("PAYERROR","支付失败");


        private String name;
        private String value;
        PayTrade(String value,String name){
            this.value=value;
            this.name=name;
        }

        public static PayTrade fromValue(String val){
            Optional<PayTrade> first = Arrays.stream(PayTrade.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return PayTrade.payerror;
        }

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }



    public enum HuawaStatus {
        PAY_ORDER_SUCCESS("PAY_ORDER_SUCCESS","支付订单成功"),
        POINT_STORE_ORDER("POINT_STORE_ORDER","指定订单给花店"),
        STORE_REFUSE_ORDER("STORE_REFUSE_ORDER","花店拒接指定单"),
        STORE_ACCEPT_ORDER("STORE_ACCEPT_ORDER","花店接单"),
        START_DELIVERY_ORDER("START_DELIVERY_ORDER","花店开始配送订单"),
        ORDER_ACHIEVE("ORDER_ACHIEVE","订单已送达"),
        ORDER_FINISH("ORDER_FINISH","订单完成"),
        CANCEL_ORDER("CANCEL_ORDER","取消订单"),
        APPLY_REFUND("APPLY_REFUND","申请退款"),
        STORE_AGREE_REFUND("STORE_AGREE_REFUND","花店同意退款"),
        STORE_REFUSE_REFUND("STORE_REFUSE_REFUND","花店拒绝退款"),
        APPLY_COMPLAINT("APPLY_COMPLAINT","订单发起申诉"),
        FINISH_COMPLAINT("FINISH_COMPLAINT","申诉完成"),
        STORE_SEND_IMG("STORE_SEND_IMG","花店上传花图"),
        ORDER_STORE_PRICE("ORDER_STORE_PRICE","花店报价"),
        STORE_CANCEL_ORDER("STORE_CANCEL_ORDER","花店撤单");
        private String value,name;

        HuawaStatus(String value,String name){
            this.value=value;
            this.name=name;
        }

        public static HuawaStatus fromValue(String val){
            return Arrays.stream(HuawaStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst().get();
        }

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public  enum OrderStatus {
        none(-1,"none"),
        tijiao(1,"已提交"),
        daiqueren(2,"待接单"),
        yijiedan(4,"已接单"),
        zhuadan(6,"转单中"),
        wancheng(8,"已完成"),
        quxiao(9,"已取消");

        private Integer value;
        private String name;
        OrderStatus(Integer value,String name){
            this.value=value;
            this.name=name;
        }

        public static OrderStatus fromValue(Integer val){
            Optional<OrderStatus> first = Arrays.stream(OrderStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return none;
        }

        public Integer getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public  enum LogisticsStatus {
        none(-1,"none"),
        daipeisong(0,"待配送"),
        daijiedan(5,"待配送员接单"),
        yijiedan(10,"配送员已接单"),
        yidaodian(15,"骑手已到店"),
        peisongzhong(20,"配送中"),
        yisongda(40,"已送达"),
        shibai(300,"呼叫物流失败"),
        zhuandan(400,"转单中"),
        yiquxiao(100,"已取消");

        private String name;
        private Integer value;
        LogisticsStatus(Integer value,String name){
            this.value=value;
            this.name=name;
        }

        public static LogisticsStatus fromValue(Integer val){
            Optional<LogisticsStatus> first = Arrays.stream(LogisticsStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return none;
        }

        public Integer getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }

    public  enum ExpressCode {
        ishansong("ishansong","闪送"),
        huayt("huayt","商家自配送"),
        meituan("meituan","美团配送"),
        eleme("eleme","饿了么配送"),
        imdada("imdada","达达快递"),
        unknow("unknow","未知");
        private String name;
        private String value;
        ExpressCode(String value,String name){
            this.value=value;
            this.name=name;
        }

        public static ExpressCode fromValue(String val){
            Optional<ExpressCode> first = Arrays.stream(ExpressCode.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return unknow;
        }

        public String getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }


    public  enum ExpressStatus {
        s101(101,"揽件"),
        s102(102,"在途中"),
        s103(103,"派送中"),
        s104(104,"已签收"),
        s105(105,"用户拒签"),
        s106(106,"疑难件"),
        s107(107,"无效单"),
        s108(108,"超时单"),
        s109(109,"签收失败"),
        s110(110,"退回"),
        s111(111,"转投"),
        s112(112,"待签"),
        s113(113,"邮件回收"),
        unknow(0,"unknow");
        private String name;
        private Integer value;

        ExpressStatus(Integer value,String name){
            this.value=value;
            this.name=name;
        }

        public static ExpressStatus fromValue(Integer val){
            Optional<ExpressStatus> first = Arrays.stream(ExpressStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return unknow;
        }

        public Integer getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }


    public  enum ExpressType {
        xianhua(1,"鲜花"),
        lipin(2,"礼品"),
        dangao(3,"蛋糕"),
        unknow(0,"unknow");
        private String name;
        private Integer value;

        ExpressType(Integer value,String name){
            this.value=value;
            this.name=name;
        }

        public static ExpressType fromValue(Integer val){
            Optional<ExpressType> first = Arrays.stream(ExpressType.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return unknow;
        }

        public Integer getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }

    public  enum BidStatus {
        biding(0,"转单中"),
        dealing(1,"交易中"),
        yiquxiao(4,"已取消"),
        done(6,"已完成");

        private String name;
        private Integer value;
        BidStatus(Integer value,String name){
            this.value=value;
            this.name=name;
        }
        public static BidStatus fromValue(Integer val){
            Optional<BidStatus> first = Arrays.stream(BidStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return null;
        }
        public Integer getValue() {
            return this.value;
        }
        public String getName() {
            return this.name;
        }
    }

    public  enum BidItemsStatus {
        unread(0,"未接单"),
        unbind(1,"取消报价"),
        biding(2,"已报价"),
        success(3,"成功接单"),
        bidcancel(4,"已取消"),
        bidfail(5,"未成交"),
        done(6,"已完成");
        private String name;
        private Integer value;
        BidItemsStatus(Integer value,String name){
            this.value=value;
            this.name=name;
        }
        public static BidItemsStatus fromValue(Integer val){
            Optional<BidItemsStatus> first = Arrays.stream(BidItemsStatus.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return null;
        }
        public Integer getValue() {
            return this.value;
        }
        public String getName() {
            return this.name;
        }
    }


    /**
     * 	orderBid: 接单消息
     * 	finance: 财务消息
     * 	expressOrder: 配送消息
     * 	orderInfo: 订单消息
     * 	userInfo: 用户消息
     * */
    public  enum UserMessage {
        userInfo("userInfo","用户消息"),
        orderInfo("orderInfo","订单消息"),
        expressOrder("expressOrder","配送消息"),
        finance("finance","财务消息"),
        orderBid("orderBid","接单消息");
        private String name;
        private String value;
        UserMessage(String value,String name){
            this.value=value;
            this.name=name;
        }
        public static UserMessage fromValue(Integer val){
            Optional<UserMessage> first = Arrays.stream(UserMessage.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return null;
        }
        public String getValue() {
            return this.value;
        }
        public String getName() {
            return this.name;
        }
    }

    public  enum OrderEvent {
        orderInfo("orderInfo","订单事件"),
        orderSend("orderSend","订单配送"),
        orderBill("orderBill","订单竞价");

        private String name;
        private String value;
        OrderEvent(String value,String name){
            this.value=value;
            this.name=name;
        }
        public static OrderEvent fromValue(Integer val){
            Optional<OrderEvent> first = Arrays.stream(OrderEvent.class.getEnumConstants()).filter(s -> StringUtil.equals(s.value,val)).findFirst();
            if(first.isPresent()){
                return first.get();
            }
            return null;
        }
        public String getValue() {
            return this.value;
        }
        public String getName() {
            return this.name;
        }
    }











}
